n = int(input())
a = [[0 for i in range(n)]for j in range(n)]
x = 0
y = -1
c = 0
while(c != n*n):
    while((y+1) < n and a[x][y+1] == 0):
        a[x][y] = c
        y += 1
        c += 1
    while((x+1) < n and a[x+1][y] == 0):
        a[x][y] = c
        x += 1
        c += 1
    while((y-1) >= 0 and a[x][y-1] == 0):
        a[x][y] = c
        y -= 1
        c += 1
    while((x-1) >= 0 and a[x-1][y] == 0):
        a[x][y] = c
        x -= 1
        c += 1
a[x][y]=n*n
for i in range(n):
    for j in range(n):
        print("%4d" % (a[i][j]), end=' ')
    print()
